package com.example.myapplication;


import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.google.android.material.snackbar.Snackbar;

public class RegisterActivity extends AppCompatActivity implements View.OnClickListener {



    private EditText regname,regpsw,repsw;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.register);
        TextView regback = findViewById(R.id.reg_back);
        TextView regbtn = findViewById(R.id.regbtn);

        regname = findViewById(R.id.regname);
        regpsw = findViewById(R.id.regpsw);
        repsw = findViewById(R.id.repsw);

        regback.setOnClickListener(this);
        regbtn.setOnClickListener(this);

    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.reg_back:
                finish();
                break;
            case R.id.regbtn:
                if(regname.getText().toString().equals("")){
                    Snackbar.make(view,"请输入会员名",Snackbar.LENGTH_SHORT).show();
                    return;
                }
                if (regpsw.getText().toString().equals("") || repsw.getText().toString().equals("")){
                    Snackbar.make(view,"请输入密码",Snackbar.LENGTH_SHORT).show();
                    return;
                }
                if (regpsw.getText().toString().equals(repsw.getText().toString())){
                    Snackbar.make(view,"两次密码不一致",Snackbar.LENGTH_SHORT).show();
                    return;
                }else {


                }



        }

    }
}
